<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
  Module: Translatable
  
    &mdash; Documentation by YARD 0.7.3
  
</title>

  <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />

  <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />

<script type="text/javascript" charset="utf-8">
  relpath = '';
  if (relpath != '') relpath += '/';
</script>

  <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>

  <script type="text/javascript" charset="utf-8" src="js/app.js"></script>


  </head>
  <body>
    <script type="text/javascript" charset="utf-8">
      if (window.top.frames.main) document.body.className = 'frames';
    </script>
    
    <div id="header">
      <div id="menu">
  
    <a href="_index.html">Index (T)</a> &raquo; 
    
    
    <span class="title">Translatable</span>
  
  
  <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
</div>

      <div id="search">
  
    <a id="class_list_link" href="#">Class List</a>
  
    <a id="method_list_link" href="#">Method List</a>
  
    <a id="file_list_link" href="#">File List</a>
  
</div>
      <div class="clear"></div>
    </div>
    
    <iframe id="search_frame"></iframe>
    
    <div id="content"><h1>Module: Translatable
  
  
  
</h1>

<dl class="box">
  
  
    
  
    
  
  
    <dt class="r1">Included in:</dt>
    <dd class="r1"><span class='object_link'><a href="Option.html" title="Option (class)">Option</a></span>, <span class='object_link'><a href="Question.html" title="Question (class)">Question</a></span></dd>
    
  
  
    <dt class="r2 last">Defined in:</dt>
    <dd class="r2 last">lib/translatable.rb</dd>
  
</dl>
<div class="clear"></div>






  
    <h2>
      Instance Method Summary
      <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
    </h2>

    <ul class="summary">
      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#set_translation_for-instance_method" title="#set_translation_for (instance method)">- (Object) <strong>set_translation_for</strong>(field, lang, str) </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#translation_for-instance_method" title="#translation_for (instance method)">- (Object) <strong>translation_for</strong>(field, lang) </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#translation_hash-instance_method" title="#translation_hash (instance method)">- (Object) <strong>translation_hash</strong>(options = {}) </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#translation_obj_for-instance_method" title="#translation_obj_for (instance method)">- (Object) <strong>translation_obj_for</strong>(field, lang) </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
    </ul>
  



  <div id="instance_method_details" class="method_details_list">
    <h2>Instance Method Details</h2>
    
    
      <div class="method_details first">
  <p class="signature first" id="set_translation_for-instance_method">
  
    - (<tt>Object</tt>) <strong>set_translation_for</strong>(field, lang, str) 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


10
11
12
13
14
15
16
17</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/translatable.rb', line 10</span>

<span class='def def kw'>def</span> <span class='set_translation_for identifier id'>set_translation_for</span><span class='lparen token'>(</span><span class='field identifier id'>field</span><span class='comma token'>,</span> <span class='lang identifier id'>lang</span><span class='comma token'>,</span> <span class='str identifier id'>str</span><span class='rparen token'>)</span>
  <span class='trans identifier id'>trans</span> <span class='assign token'>=</span> <span class='translation_obj_for identifier id'>translation_obj_for</span><span class='lparen token'>(</span><span class='field identifier id'>field</span><span class='comma token'>,</span> <span class='lang identifier id'>lang</span><span class='rparen token'>)</span>
  <span class='unless unless kw'>unless</span> <span class='trans identifier id'>trans</span>
    <span class='trans identifier id'>trans</span> <span class='assign token'>=</span> <span class='translations identifier id'>translations</span><span class='dot token'>.</span><span class='build identifier id'>build</span><span class='lparen token'>(</span><span class='symbol val'>:fld</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='field identifier id'>field</span><span class='comma token'>,</span> <span class='symbol val'>:class_name</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='class identifier id'>class</span><span class='dot token'>.</span><span class='name identifier id'>name</span><span class='comma token'>,</span> <span class='symbol val'>:language_id</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='lang identifier id'>lang</span><span class='dot token'>.</span><span class='id identifier id'>id</span><span class='rparen token'>)</span>
    <span class='translation_hash identifier id'>translation_hash</span><span class='lparen token'>(</span><span class='symbol val'>:rebuild</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='true true kw'>true</span><span class='rparen token'>)</span>
  <span class='end end kw'>end</span>
  <span class='trans identifier id'>trans</span><span class='dot token'>.</span><span class='str identifier id'>str</span> <span class='assign token'>=</span> <span class='str identifier id'>str</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="translation_for-instance_method">
  
    - (<tt>Object</tt>) <strong>translation_for</strong>(field, lang) 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


6
7
8
9</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/translatable.rb', line 6</span>

<span class='def def kw'>def</span> <span class='translation_for identifier id'>translation_for</span><span class='lparen token'>(</span><span class='field identifier id'>field</span><span class='comma token'>,</span> <span class='lang identifier id'>lang</span><span class='rparen token'>)</span>
  <span class='trans identifier id'>trans</span> <span class='assign token'>=</span> <span class='translation_obj_for identifier id'>translation_obj_for</span><span class='lparen token'>(</span><span class='field identifier id'>field</span><span class='comma token'>,</span> <span class='lang identifier id'>lang</span><span class='rparen token'>)</span>
  <span class='trans identifier id'>trans</span> <span class='integer val'>? </span><span class='trans identifier id'>trans</span><span class='dot token'>.</span><span class='str identifier id'>str</span> <span class='colon op'>:</span> <span class='nil nil kw'>nil</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="translation_hash-instance_method">
  
    - (<tt>Object</tt>) <strong>translation_hash</strong>(options = {}) 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


18
19
20
21
22
23</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/translatable.rb', line 18</span>

<span class='def def kw'>def</span> <span class='translation_hash identifier id'>translation_hash</span><span class='lparen token'>(</span><span class='options identifier id'>options</span> <span class='assign token'>=</span> <span class='lbrace token'>{</span><span class='rbrace token'>}</span><span class='rparen token'>)</span>
  <span class='if if kw'>if</span> <span class='notop op'>!</span><span class='@translation_hash ivar id'>@translation_hash</span> <span class='orop op'>||</span> <span class='options identifier id'>options</span><span class='lbrack token'>[</span><span class='symbol val'>:rebuild</span><span class='rbrack token'>]</span>
    <span class='@translation_hash ivar id'>@translation_hash</span> <span class='assign token'>=</span> <span class='Hash constant id'>Hash</span><span class='lbrack token'>[</span><span class='mult op'>*</span><span class='translations identifier id'>translations</span><span class='dot token'>.</span><span class='collect identifier id'>collect</span><span class='lbrace token'>{</span><span class='bitor op'>|</span><span class='t identifier id'>t</span><span class='bitor op'>|</span> <span class='lbrack token'>[</span><span class='dstring node'>&quot;#{t.fld}__#{t.language_id}&quot;</span><span class='comma token'>,</span> <span class='t identifier id'>t</span><span class='rbrack token'>]</span><span class='rbrace token'>}</span><span class='dot token'>.</span><span class='flatten identifier id'>flatten</span><span class='rbrack token'>]</span>
  <span class='end end kw'>end</span>
  <span class='@translation_hash ivar id'>@translation_hash</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="translation_obj_for-instance_method">
  
    - (<tt>Object</tt>) <strong>translation_obj_for</strong>(field, lang) 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


2
3
4
5</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/translatable.rb', line 2</span>

<span class='def def kw'>def</span> <span class='translation_obj_for identifier id'>translation_obj_for</span><span class='lparen token'>(</span><span class='field identifier id'>field</span><span class='comma token'>,</span> <span class='lang identifier id'>lang</span><span class='rparen token'>)</span>
  <span class='lang identifier id'>lang</span> <span class='opasgn op'>||=</span> <span class='Language constant id'>Language</span><span class='dot token'>.</span><span class='english identifier id'>english</span>
  <span class='trans identifier id'>trans</span> <span class='assign token'>=</span> <span class='translation_hash identifier id'>translation_hash</span><span class='lbrack token'>[</span><span class='dstring node'>&quot;#{field.to_s}__#{lang.id}&quot;</span><span class='rbrack token'>]</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

</div>
    
    <div id="footer">
  Generated on Thu Dec  8 13:43:18 2011 by 
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
  0.7.3 (ruby-1.8.7).
</div>

  </body>
</html>